//
//  BDPostCell.h
//  BadBoy
//
//  Created by wen on 2017/9/1.
//  Copyright © 2017年 com.8xiong. All rights reserved.
//

#import "BDBaseTableViewCell.h"
#import "BDPostLayout.h"

@class BDPostCell;
@protocol BDPostCellDelegate;

@interface BDPostProfileView : UIView
@property (nonatomic, strong) UIImageView *avatarView; ///< 头像
@property (nonatomic, strong) UIImageView *avatarBadgeView; ///< 徽章
@property (nonatomic, strong) YYLabel *nameLabel;
@property (nonatomic, strong) YYLabel *sourceLabel;
@property (nonatomic, strong) UIImageView *backgroundImageView;
@property (nonatomic, strong) UIButton *arrowButton;
@property (nonatomic, strong) UIButton *followButton;
@property (nonatomic, assign) BDUserVerifyType verifyType;
@property (nonatomic, weak) BDPostCell *cell;
@end

@interface BDPostCardView : UIView
@property (nonatomic, strong) UIImageView *imageView;
@property (nonatomic, strong) UIImageView *badgeImageView;
@property (nonatomic, strong) YYLabel *label;
@property (nonatomic, strong) UIButton *button;
@property (nonatomic, weak) BDPostCell *cell;
@property (nonatomic, assign) BOOL displayAsync;
@end


@interface BDPostToolbarView : UIView
@property (nonatomic, strong) UIButton *repostButton;
@property (nonatomic, strong) UIButton *commentButton;
@property (nonatomic, strong) UIButton *likeButton;
@property (nonatomic, strong) UIButton *sharedButton;

@property (nonatomic, strong) UIImageView *repostImageView;
@property (nonatomic, strong) UIImageView *commentImageView;
@property (nonatomic, strong) UIImageView *likeImageView;
@property (nonatomic, strong) UIImageView *sharedImageView;

@property (nonatomic, strong) YYLabel *repostLabel;
@property (nonatomic, strong) YYLabel *commentLabel;
@property (nonatomic, strong) YYLabel *likeLabel;
@property (nonatomic, strong) YYLabel *sharedLabel;

@property (nonatomic, strong) CAGradientLayer *line1;
@property (nonatomic, strong) CAGradientLayer *line2;
@property (nonatomic, strong) CAGradientLayer *line3;
@property (nonatomic, strong) CALayer *topLine;
@property (nonatomic, strong) CALayer *bottomLine;
@property (nonatomic, weak) BDPostCell *cell;

- (void)setWithLayout:(BDPostLayout *)layout;
// set both "liked" and "likeCount"
- (void)setLiked:(BOOL)liked withAnimation:(BOOL)animation;
@end

@interface BDPostView : UIView

@property (nonatomic, strong) UIView *contentView;              // 容器
@property (nonatomic, strong) BDPostProfileView *profileView; // 用户资料
@property (nonatomic, strong) YYLabel *textLabel;               // 文本
@property (nonatomic, strong) NSArray<UIView *> *picViews;      // 图片
@property (nonatomic, strong) UIView *retweetBackgroundView;    //转发容器
@property (nonatomic, strong) YYLabel *retweetTextLabel;        // 转发文本
@property (nonatomic, strong) BDPostCardView *cardView;       // 卡片
@property (nonatomic, strong) BDPostToolbarView *toolbarView; // 工具栏
//@property (nonatomic, strong) UIImageView *vipBackgroundView;   // VIP 自定义背景
@property (nonatomic, strong) UIButton *menuButton;             // 菜单按钮
@property (nonatomic, strong) UIButton *openButton;           // 关注按钮
@property (nonatomic, assign) BOOL displayAsync;

@property (nonatomic, strong) BDPostLayout *layout;
@property (nonatomic, weak) BDPostCell *cell;
@end


@interface BDPostCell : BDBaseTableViewCell
@property (nonatomic, weak) id<BDPostCellDelegate> delegate;
@property (nonatomic, strong) BDPostView *postView;
- (void)setLayout:(BDPostLayout *)layout needCoverText:(BOOL)needCover;

@end

@protocol BDPostCellDelegate <NSObject>
@optional
/// 点击了 Cell
- (void)cellDidClick:(BDPostCell *)cell;
/// 点击了 Card
- (void)cellDidClickCard:(BDPostCell *)cell;
/// 点击了转发内容
- (void)cellDidClickRetweet:(BDPostCell *)cell;
/// 点击了Cell菜单
- (void)cellDidClickMenu:(BDPostCell *)cell;
///点击了显示全部
- (void)cellDidClickOpen:(BDPostCell *)cell;
/// 点击了关注
- (void)cellDidClickFollow:(BDPostCell *)cell;
/// 点击了转发
- (void)cellDidClickRepost:(BDPostCell *)cell;
/// 点击了下方 Tag
- (void)cellDidClickTag:(BDPostCell *)cell;
/// 点击了评论
- (void)cellDidClickComment:(BDPostCell *)cell;
/// 点击了赞
- (void)cellDidClickLike:(BDPostCell *)cell;
///点击了分享
- (void)cellDidClickShared:(BDPostCell *)cell;
/// 点击了用户
- (void)cell:(BDPostCell *)cell didClickUser:(BDUserModel *)user;
/// 点击了图片
- (void)cell:(BDPostCell *)cell didClickImageAtIndex:(NSUInteger)index;
/// 点击了 Label 的链接
- (void)cell:(BDPostCell *)cell didClickInLabel:(YYLabel *)label textRange:(NSRange)textRange;
@end
